﻿/*-------------------------------------------------------------------------
* 命名空间: SiliconSelect.DAL/DataAccess
* 类       名: DataAccess
* 功      能:  数据库访问类
* 时      间:  2023/6/20 15:38:08
* 版      本:  V1.0
* 作      者:  Fioman
* 格      言:  Talk is cheap,show me the code ^_^
*-------------------------------------------------------------------------*/
using SiliconSelect.Common;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SiliconSelect.DAL
{
    public class DataAccess
    {

        /// <summary>
        /// 获取所有的数据(满足条件的所有数据),如果没有参数就不写.
        /// 返回类型是DataTable类型.
        /// </summary>
        /// <param name="sql"></param>
        /// <param name="parameters"></param>
        /// <returns></returns>
        public static DataTable GetDataTables(string sql, SqlParameter[]? parameters)
        {
            DataTable dt = new DataTable();
            try
            {
                dt = SqlHelper.ExecuteDataTable(sql, parameters);
            }
            catch (Exception )
            {
                throw;
            }
            return dt;
        }
    }
}
